package com.example;

/**
 * 跟踪
 */
public class Trace {

    public enum TraceAction {
        DEPART(1, "发车"),
        ARRIVAL(2, "到站"),
        ARRIVAL_END(3, "抵达终点站"),
        UP_DOWN_GUEST(4, "上下客");
        private int type;
        private String desc;

        TraceAction(int type, String desc) {
            this.type = type;
            this.desc = desc;
        }

        public int getType() {
            return type;
        }

        public String getDesc() {
            return desc;
        }
    }

    /**
     * 时间点
     */
    private long timePoint;


    /**
     * 动作,1 发车； 2，到站； 3，到终点站; 4,上下客
     */
    private TraceAction traceAction;

    /**
     * 当前乘客数量
     */
    private int currentGuest;

    /**
     * 上客数
     */
    private int upGuest;

    /**
     * 下客数
     */
    private int downGuest;

    public String getSiteName() {
        return siteName;
    }

    public void setSiteName(String siteName) {
        this.siteName = siteName;
    }

    /**
     * 站点名
     */
    private String siteName;

    public String getTimePoint() {
        return String.format("%02d:%02d", timePoint / 60 / 60, timePoint / 60 % 60);
//        return String.valueOf(timePoint);
    }

    public void setTimePoint(long timePoint) {
        this.timePoint = timePoint;
    }

    public TraceAction getTraceAction() {
        return traceAction;
    }

    public void setTraceAction(TraceAction traceAction) {
        this.traceAction = traceAction;
    }

    public int getUpGuest() {
        return upGuest;
    }

    public int getCurrentGuest() {
        return currentGuest;
    }

    public void setCurrentGuest(int currentGuest) {
        this.currentGuest = currentGuest;
    }

    public void setUpGuest(int upGuest) {
        this.upGuest = upGuest;
    }

    public int getDownGuest() {
        return downGuest;
    }

    public void setDownGuest(int downGuest) {
        this.downGuest = downGuest;
    }

    @Override
    public String toString() {
        return "行驶记录: {" +
                "时间: " + getTimePoint() +
                ", 行为: " + traceAction.getDesc() +
                ", 乘客数: " + currentGuest +
                ", 此站上客: " + upGuest +
                ", 此站下客: " + downGuest +
                ", 站点: '" + siteName + '\'' +
                '}';
    }
}
